from pynput import mouse, keyboard
from app.input_handler import on_press, on_release, on_click
from app.gui import WeaponConfigGUI
import threading

def start_listeners():
    # 启动键鼠监听
    keyboard_listener = keyboard.Listener(on_press=on_press, on_release=on_release)
    keyboard_listener.start()
    
    with mouse.Listener(on_click=on_click) as listener:
        listener.join()

def main():
    # 启动监听线程
    listener_thread = threading.Thread(target=start_listeners, daemon=True)
    listener_thread.start()
    
    # 在主线程中运行GUI
    gui = WeaponConfigGUI()
    gui.run()

if __name__ == '__main__':
    main()

